
cmake_minimum_required(VERSION 3.0)
project(openshell)
if(MSVC)
    set(CMAKE_GENERATOR_TOOLSET "host=x64")
    add_definitions(-DUNICODE -D_UNICODE -DGOOGLE_GLOG_DLL_DECL= -DGLOG_NO_ABBREVIATED_SEVERITIES)
endif(MSVC)

add_subdirectory(${CMAKE_SOURCE_DIR}/third/qtermwidget)
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTOUIC ON)
set(CMAKE_AUTORCC ON)
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)


find_package(Qt5 COMPONENTS Core Gui Widgets)
file(GLOB_RECURSE SRC_LIST ${CMAKE_SOURCE_DIR}/src/*.cpp)
file(GLOB_RECURSE INC_LIST ${CMAKE_SOURCE_DIR}/src/*.h)
add_executable(${CMAKE_PROJECT_NAME} ${SRC_LIST} ${INC_LIST})
add_dependencies(${CMAKE_PROJECT_NAME} qtermwidget5)

target_include_directories(${CMAKE_PROJECT_NAME} PRIVATE ${CMAKE_SOURCE_DIR}/src)
target_link_libraries(${CMAKE_PROJECT_NAME} ${VTK_LIBRARIES})
target_link_libraries(${CMAKE_PROJECT_NAME} Qt5::Core Qt5::Widgets Qt5::Gui qtermwidget5)

if(MSVC)
    set_target_properties(${CMAKE_PROJECT_NAME} PROPERTIES LINK_FLAGS_RELEASE "/SUBSYSTEM:WINDOWS /ENTRY:mainCRTStartup")
    set_target_properties(${CMAKE_PROJECT_NAME} PROPERTIES LINK_FLAGS "/SUBSYSTEM:WINDOWS /ENTRY:mainCRTStartup")
    set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /Zi /MP /Gm-")
    set_target_properties(${CMAKE_PROJECT_NAME} PROPERTIES COMPILE_FLAGS "/Od")
    set_target_properties(${CMAKE_PROJECT_NAME} PROPERTIES LINK_FLAGS "/DEBUG")
    target_compile_options(${CMAKE_PROJECT_NAME} PRIVATE "/wd4267")
endif(MSVC)



